from django.contrib.auth.models import User
from django.db import models

# Create your models here.
class Defect(models.Model):
    outage = models.CharField(max_length=32)
    main_order = models.CharField(max_length=64)
    order_detail = models.TextField()
    defect_detail = models.TextField()
    equipment = models.CharField(max_length=64)
    defect_order = models.CharField(max_length=64, unique=True)
    defect_date = models.DateField()
    deal_order = models.CharField(max_length=64, blank=True, null=True)
    deal_detail = models.TextField(blank=True, null=True)
    is_closed = models.BooleanField(default=False)
    closed_date = models.DateField(blank=True, null=True)
    deal_department = models.CharField(max_length=64, blank=True, null=True)
    team = models.CharField(max_length=32)
    create_user = models.ForeignKey(User, on_delete='CASCADE', blank=True, null=True)
    is_delete = models.BooleanField(default=False)
    is_concerned = models.BooleanField(default=False)

    def __str__(self):
        return self.defect_order
